<?php



/**
 * 文章管理
 * Enter description here ...
 * @author Admin
 *
 * 登录注册页：服务条款
 */
class ArticleAction extends CommonAction{

	
	/**
	 * 首页显示
	 * Enter description here ...
	 */
    public function index()   {
    	$article = D('Article');
    	
    	//TODO: 关于拍板 文章类型7
		
		$article_categories = D('Article_categories');  //文章分类
		$article_categoriesmap['fid'] = array('eq',7);     //关于拍板文章类型
		$article_categoriesdata = $article_categories->where($article_categoriesmap)->findAll();
		
		foreach ($article_categoriesdata as &$val){
			unset($valmap);
			$valmap['state'] = array('eq',1);
			$valmap['cid'] = array('eq',$val['id']);
			
			$val['article'] = $article->getdata($valmap);   //类型下属文章
		}
		
		$id = GetNum($_GET['id']);   //主键ID
			if (empty($id))
				$id = 11;   //关于
		
		$data = $article->find($id);  //文章
		
		if ($data['state'] != 1)   //启用状态
			$data = null;
		
			
		$this->assign('article_categoriesdata',$article_categoriesdata);
		$this->assign('data',$data);
    	
        $this->display();
    }
    
    
    
}
?>